package com.flyxteam.supports.model;

/**
 * ActionResult的敏捷支持
 * <ul>
 * <li>2017-01-01 | ChrisX | + create</li>
 * </ul>
 * @author ChrisX
 */
public class ActionResults {

    // #create
    public static ActionResult create(String code, String message, Object data) {
        return new ActionResult(code, message, data);
    }
    public static ActionResult create(String code, String message) {
        return create(code, message, null);
    }
    public static ActionResult create(String code) {
        return create(code, null, null);
    }
    // /create
    
    // #success
    public static ActionResult createSuccess(String message, Object data) {
        return new ActionResult("200", message, data);
    }
    public static ActionResult createSuccess(String message) {
        return createSuccess(message, null);
    }
    public static ActionResult createSuccess(Object data) {
        return createSuccess("", data);
    }
    public static ActionResult createSuccess() {
        return createSuccess("", null);
    }
    // /success
    
    // #unauthorised
    public static ActionResult createUnauthorised(String message, Object data) {
        return new ActionResult("300", message, data);
    }
    public static ActionResult createUnauthorised(String message) {
        return createUnauthorised(message, null);
    }
    public static ActionResult createUnauthorised(Object data) {
        return createUnauthorised("", data);
    }
    public static ActionResult createUnauthorised() {
        return createUnauthorised("", null);
    }
    // /unauthorised
    
    // #invalidation
    public static ActionResult createInvalidation(String message, Object data) {
        return new ActionResult("400", message, data);
    }
    public static ActionResult createInvalidation(String message) {
        return createInvalidation(message, null);
    }
    public static ActionResult createInvalidation(Object data) {
        return createInvalidation("", data);
    }
    public static ActionResult createInvalidation() {
        return createInvalidation("", null);
    }
    // /invalidation
    
    // #failure
    public static ActionResult createFailure(String message, Object data) {
        return new ActionResult("500", message, data);
    }
    public static ActionResult createFailure(String message) {
        return createFailure(message, null);
    }
    public static ActionResult createFailure(Object data) {
        return createFailure("", data);
    }
    public static ActionResult createFailure() {
        return createFailure("", null);
    }
    // /failure
    
    // #exception
    public static ActionResult createException(String message, Object data) {
        return new ActionResult("600", message, data);
    }
    public static ActionResult createException(String message) {
        return createException(message, null);
    }
    public static ActionResult createException(Object data) {
        return createException("", data);
    }
    public static ActionResult createException() {
        return createException("", null);
    }
    // /exception

}
